home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Serious Demos / Symbolic Composer 4.2 / Environment / Projects / Questions & Answers / Q&A Programming Functions / Accessing motive slots next >
Encoding:
Text File  |  1998-10-26  |  1.2 KB  |  35 lines  |  [TEXT/ScoM]

  1. ACCESSING MOTIVE SLOTS
  2.  
  3. >Does anyone knows why the SCOM 4.0 compiler detects a problem with setf 
  4. >in this code?
  5. >
  6. >(def-motive pp
  7. >symbol '(a b c d e f))
  8. >(msymbol pp)
  9. >(setf (msymbol pp) '(a b c))
  10. >(msymbol pp)
  11. >
  12. >The interpreter report:
  13. >;Interpreter warnings :
  14. >;   Undeclared free variable pp, in an anonymous lambda form.
  15.  
  16. You have to use the following:
  17.  
  18. (setf (slot-value pp 'symbol) '(a b c))
  19.  
  20. Motive class is as below. It has accessors which start with m. MCL
  21. mechanism seems to have some restrictions using setf with accessors.
  22.  
  23. (defclass motive ()
  24.    ((symbol :initarg :symbol :initform nil :accessor msymbol) 
  25.     (length :initarg :length :initform nil :accessor mlength)
  26.     (velocity :initarg :velocity :initform nil :accessor mvelocity)
  27.     (channel :initarg :channel :initform nil :accessor mchannel)
  28.     (program :initarg :program :initform nil :accessor mprogram)
  29.     (controller :initarg :controller :initform nil :accessor mcontroller)
  30.     (duration :initarg :duration :initform nil :accessor mduration)
  31.     (tuning :initarg :tuning :initform nil :accessor mtuning)
  32.     (groove :initarg :groove :initform nil :accessor mgroove)
  33.     (zone :initarg :zone :initform nil :accessor mzone)
  34.     (tonality :initarg :tonality :initform nil :accessor mtonality)))
  35.